package com.awn.weidian.demo.mapper;

import com.awn.weidian.demo.pojo.Hierarchy;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper

public interface IHierarchy {

    @Select("select * from hierarchy")
    public List<Hierarchy> showList();

    @Insert("insert into hierarchy(level,levelname,consumption,consumptions) values(#{level},#{levelname},#{consumption},#{consumptions})")
    public int addUser(Hierarchy Hierarchy);

    @Select("select * from hierarchy where level=#{aa}")
    public Hierarchy findLevel(String aa);

    @Select("select * from hierarchy where levelname=#{bb}")
    public Hierarchy findLevelname(String bb);

    @Select("select * from hierarchy where consumption<= #{cc}  and consumptions>= #{cc}")
    public Hierarchy findConsumption(String cc);
    @Update("update hierarchy set levelname=#{levelname},consumption=#{consumption},consumptions=#{consumptions} where level = #{level}")
    public int update(Hierarchy Hierarchy);

    @Delete("delete from hierarchy where level = #{level}")
    public int deleteUser(String aa);



}
